package com.example.demo1.dao;
import com.example.demo1.model.UserInfo;
import com.example.demo1.model.VO.UserInfoVO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 言初
 * Date: 2024-06-19
 * Time: 18:19
 */
public interface UserMapper {
    // 把用户注册数据添加到数据库的用户表中
    @Insert("insert into userinfo(username,password) values(#{username},#{password})")
    int reg(UserInfo userInfo);

    // 通过用户名查询对象
    @Select("select * from userinfo where username = #{username}")
    UserInfo getUserByName(@Param("username") String username);


    // 根据用户ID来查询用户对象
    @Select("select * from userinfo where id=#{uid}")
    UserInfoVO getUserById(@Param("uid")int uid);


}
